<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Origami::Name</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Origami::Name</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/origami/name_rb.html">
                origami/name.rb
                </a>
        <br />
                <a href="../../files/origami/obfuscation_rb.html">
                origami/obfuscation.rb
                </a>
        <br />
                <a href="../../files/origami/docmdp_rb.html">
                origami/docmdp.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Class representing a <a href="Name.html">Name</a> <a
href="Object.html">Object</a>. <a href="Name.html">Name</a> objects are
strings which identify some <a href="PDF.html">PDF</a> file inner
structures.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000493">new</a>&nbsp;&nbsp;
      <a href="#M000496">real_type</a>&nbsp;&nbsp;
      <a href="#M000498">to_docmdp_str</a>&nbsp;&nbsp;
      <a href="#M000497">to_obfuscated_str</a>&nbsp;&nbsp;
      <a href="#M000494">value</a>&nbsp;&nbsp;
      <a href="#M000495">value</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name"><a href="Object.html">Origami::Object</a></span>
      </div>
    </div>

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000493" class="method-detail">
        <a name="M000493"></a>

        <div class="method-heading">
          <a href="#M000493" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(name = &quot;&quot;)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Creates a <a href="Name.html#M000493">new</a> <a href="Name.html">Name</a>.
</p>
<table>
<tr><td valign="top"><em>name</em>:</td><td>A symbol representing the <a href="Name.html#M000493">new</a> <a
href="Name.html">Name</a> <a href="Name.html#M000494">value</a>.

</td></tr>
</table>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000493-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000493-source">
<pre>
    <span class="ruby-comment cmt"># File origami/name.rb, line 74</span>
74:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">name</span> = <span class="ruby-value str">&quot;&quot;</span>)
75:       <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Symbol</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">name</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">String</span>)
76:         <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">&quot;Expected type Symbol or String, received #{name.class}.&quot;</span>
77:       <span class="ruby-keyword kw">end</span>
78:       
79:       <span class="ruby-ivar">@value</span> = <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>
80:       
81:       <span class="ruby-keyword kw">super</span>()
82:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000496" class="method-detail">
        <a name="M000496"></a>

        <div class="method-heading">
          <a href="#M000496" class="method-signature">
          <span class="method-name">real_type</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000496-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000496-source">
<pre>
     <span class="ruby-comment cmt"># File origami/name.rb, line 166</span>
166:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">real_type</span> ; <span class="ruby-constant">Name</span> <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000498" class="method-detail">
        <a name="M000498"></a>

        <div class="method-heading">
          <a href="#M000498" class="method-signature">
          <span class="method-name">to_docmdp_str</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000498-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000498-source">
<pre>
    <span class="ruby-comment cmt"># File origami/docmdp.rb, line 53</span>
53:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_docmdp_str</span>
54:       [ <span class="ruby-value">4</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">length</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_s</span> ].<span class="ruby-identifier">pack</span>(<span class="ruby-value str">&quot;CNA*&quot;</span>)
55:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000497" class="method-detail">
        <a name="M000497"></a>

        <div class="method-heading">
          <a href="#M000497" class="method-signature">
          <span class="method-name">to_obfuscated_str</span><span class="method-args">(prop = 2)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000497-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000497-source">
<pre>
     <span class="ruby-comment cmt"># File origami/obfuscation.rb, line 185</span>
185:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_obfuscated_str</span>(<span class="ruby-identifier">prop</span> = <span class="ruby-value">2</span>)
186:       <span class="ruby-identifier">name</span> = <span class="ruby-ivar">@value</span>.<span class="ruby-identifier">dup</span>
187:       
188:       <span class="ruby-identifier">forbiddenchars</span> = [ <span class="ruby-value str">&quot; &quot;</span>,<span class="ruby-value str">&quot;#&quot;</span>,<span class="ruby-value str">&quot;\t&quot;</span>,<span class="ruby-value str">&quot;\r&quot;</span>,<span class="ruby-value str">&quot;\n&quot;</span>,<span class="ruby-value str">&quot;\0&quot;</span>,<span class="ruby-value str">&quot;[&quot;</span>,<span class="ruby-value str">&quot;]&quot;</span>,<span class="ruby-value str">&quot;&lt;&quot;</span>,<span class="ruby-value str">&quot;&gt;&quot;</span>,<span class="ruby-value str">&quot;(&quot;</span>,<span class="ruby-value str">&quot;)&quot;</span>,<span class="ruby-value str">&quot;%&quot;</span>,<span class="ruby-value str">&quot;/&quot;</span>,<span class="ruby-value str">&quot;\\&quot;</span> ]
189: 
190:       <span class="ruby-identifier">name</span>.<span class="ruby-identifier">gsub!</span>(<span class="ruby-regexp re">/./</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span>
191:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rand</span>(<span class="ruby-identifier">prop</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">forbiddenchars</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">c</span>)
192:           <span class="ruby-identifier">hexchar</span> = <span class="ruby-identifier">c</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_s</span>(<span class="ruby-identifier">base</span>=<span class="ruby-value">16</span>)
193:           <span class="ruby-identifier">hexchar</span> = <span class="ruby-value str">&quot;0&quot;</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">hexchar</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hexchar</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">2</span>
194:           
195:           <span class="ruby-value str">'#'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">hexchar</span>
196:         <span class="ruby-keyword kw">else</span>
197:           <span class="ruby-identifier">c</span>
198:         <span class="ruby-keyword kw">end</span>
199:       <span class="ruby-keyword kw">end</span>
200: 
201:       <span class="ruby-keyword kw">super</span>(<span class="ruby-constant">TOKENS</span>.<span class="ruby-identifier">first</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">name</span>)
202:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000494" class="method-detail">
        <a name="M000494"></a>

        <div class="method-heading">
          <a href="#M000494" class="method-signature">
          <span class="method-name">value</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000494-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000494-source">
<pre>
    <span class="ruby-comment cmt"># File origami/name.rb, line 85</span>
85:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">value</span>   
86:         ( <span class="ruby-ivar">@value</span>.<span class="ruby-identifier">empty?</span> ) <span class="ruby-operator">?</span> <span class="ruby-constant">EmptySymbol</span>.<span class="ruby-identifier">new</span> <span class="ruby-operator">:</span> <span class="ruby-ivar">@value</span>.<span class="ruby-identifier">to_sym</span>
87:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000495" class="method-detail">
        <a name="M000495"></a>

        <div class="method-heading">
          <a href="#M000495" class="method-signature">
          <span class="method-name">value</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000495-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000495-source">
<pre>
    <span class="ruby-comment cmt"># File origami/name.rb, line 89</span>
89:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">value</span>   
90:         <span class="ruby-ivar">@value</span>.<span class="ruby-identifier">to_sym</span>
91:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>